package com.stu.wgt.test.result;


/**
 * 状态码
 */
public enum ResultCodeEnum {

//    SUCCESS(true, 200, "成功"),
//    TEST_NUMBER(false, 500, "计算错误"),
//    UNKNOWN_REASON(false, 20001, "未知错误");

    // 成功
    SUCCESS(true, 200, "成功"),

    // 客户端错误
    BAD_REQUEST(false, 400, "请求参数有误"),
    UNAUTHORIZED(false, 401, "未经授权"),
    FORBIDDEN(false, 403, "禁止访问"),
    NOT_FOUND(false, 404, "资源不存在"),
    METHOD_NOT_ALLOWED(false, 405, "不支持的请求方法"),
    REQUEST_TIMEOUT(false, 408, "请求超时"),
    CONFLICT(false, 409, "资源冲突"),
    GONE(false, 410, "资源已删除"),
    UNSUPPORTED_MEDIA_TYPE(false, 415, "不支持的媒体类型"),
    TOO_MANY_REQUESTS(false, 429, "请求过多"),

    // 服务器错误
    INTERNAL_SERVER_ERROR(false, 500, "服务器内部错误"),
    NOT_IMPLEMENTED(false, 501, "功能未实现"),
    BAD_GATEWAY(false, 502, "网关错误"),
    SERVICE_UNAVAILABLE(false, 503, "服务不可用"),
    GATEWAY_TIMEOUT(false, 504, "网关超时"),
    HTTP_VERSION_NOT_SUPPORTED(false, 505, "HTTP版本不支持"),

    // 自定义状态码
    UNKNOWN_REASON(false, 10000, "未知错误");

    private final Boolean success;

    private final Integer code;

    private final String message;

    ResultCodeEnum(Boolean success, Integer code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    public Boolean getSuccess() {
        return success;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "ResultCodeEnum{" + "success=" + success + ", code=" + code + ", message='" + message + '\'' + '}';
    }
}